package Pokero;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextPane;

public class Komunikat extends JFrame implements ActionListener {
	private JFrame komunikat;
	private JTextPane KomText;
	private	JButton exit;
	
	public Komunikat() {
		super("Komunikat");
		komunikat  = new JFrame();
		setVisible(true);
        setSize(300,150);
        setLayout(new FlowLayout());
        setLocationRelativeTo(null);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
        Font f = new Font(Font.SANS_SERIF, 5, 17);
        KomText = new JTextPane();
        KomText.setVisible(true);
		KomText.setEditable(false);
        KomText.setBackground(null);
        KomText.setForeground(Color.RED);
        KomText.setFont(f);
        KomText.setText("Zaden gracz nie podjal licytacji!");
        
        add(KomText);
        
        
        exit = new JButton("Zamknij");
        
        exit.addActionListener(this);
        
        add(exit);
        
        
        
        
      //blokada rozmiaru okna
        this.addComponentListener(new ComponentAdapter(){
    public void componentResized(ComponentEvent e){
        Dimension d=Komunikat.this.getSize();
        if(d.width != 300)
            d.width=300;
        if(d.height != 150)
            d.height=150;
        Komunikat.this.setSize(d);
    }
});
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		Object source = e.getSource();
		
		if(source == exit)
			dispose();
		
	}
}
